package com.example.springbootjdbc.service.impl;

import com.example.springbootjdbc.dao.UserDao;
import com.example.springbootjdbc.pojo.User;
import com.example.springbootjdbc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Description:springbootweb
 * Created by admin  on 2020/4/17  16:54
 */

/**
 * 用户管理业务层
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    /**
     * 添加用户
     * @param user
     */
    @Override
    @Transactional
    public void addUser(User user) {
        userDao.addUser(user);
    }

    /**
     * 查询所有用户
     * @return
     */
    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }
}
